<?php

require_once 'propel/om/BaseObject.php';

require_once 'propel/om/Persistent.php';


include_once 'propel/util/Criteria.php';

include_once 'cms/core/om/LanguagePeer.php';

/**
 * Base class that represents a row from the 'language' table.
 *
 * 
 *
 * @package cms.core.om.om
 */
abstract class BaseLanguage extends BaseObject  implements Persistent {


	/**
	 * The Peer class.
	 * Instance provides a convenient way of calling static methods on a class
	 * that calling code may not be able to identify.
	 * @var LanguagePeer
	 */
	protected static $peer;


	/**
	 * The value for the code field.
	 * @var string
	 */
	protected $code;


	/**
	 * The value for the name field.
	 * @var string
	 */
	protected $name;


	/**
	 * The value for the i18n field.
	 * @var boolean
	 */
	protected $i18n = false;


	/**
	 * The value for the image field.
	 * @var boolean
	 */
	protected $image = false;


	/**
	 * The value for the active field.
	 * @var boolean
	 */
	protected $active = false;

	/**
	 * Collection to store aggregation of collContentI18ns.
	 * @var array
	 */
	protected $collContentI18ns;

	/**
	 * The criteria used to select the current contents of collContentI18ns.
	 * @var Criteria
	 */
	protected $lastContentI18nCriteria = null;

	/**
	 * Collection to store aggregation of collCategoryI18ns.
	 * @var array
	 */
	protected $collCategoryI18ns;

	/**
	 * The criteria used to select the current contents of collCategoryI18ns.
	 * @var Criteria
	 */
	protected $lastCategoryI18nCriteria = null;

	/**
	 * Collection to store aggregation of collEventI18ns.
	 * @var array
	 */
	protected $collEventI18ns;

	/**
	 * The criteria used to select the current contents of collEventI18ns.
	 * @var Criteria
	 */
	protected $lastEventI18nCriteria = null;

	/**
	 * Collection to store aggregation of collGuideI18ns.
	 * @var array
	 */
	protected $collGuideI18ns;

	/**
	 * The criteria used to select the current contents of collGuideI18ns.
	 * @var Criteria
	 */
	protected $lastGuideI18nCriteria = null;

	/**
	 * Collection to store aggregation of collMenus.
	 * @var array
	 */
	protected $collMenus;

	/**
	 * The criteria used to select the current contents of collMenus.
	 * @var Criteria
	 */
	protected $lastMenuCriteria = null;

	/**
	 * Collection to store aggregation of collMenuItemI18ns.
	 * @var array
	 */
	protected $collMenuItemI18ns;

	/**
	 * The criteria used to select the current contents of collMenuItemI18ns.
	 * @var Criteria
	 */
	protected $lastMenuItemI18nCriteria = null;

	/**
	 * Collection to store aggregation of collProjectI18ns.
	 * @var array
	 */
	protected $collProjectI18ns;

	/**
	 * The criteria used to select the current contents of collProjectI18ns.
	 * @var Criteria
	 */
	protected $lastProjectI18nCriteria = null;

	/**
	 * Collection to store aggregation of collStaffs.
	 * @var array
	 */
	protected $collStaffs;

	/**
	 * The criteria used to select the current contents of collStaffs.
	 * @var Criteria
	 */
	protected $lastStaffCriteria = null;

	/**
	 * Flag to prevent endless save loop, if this object is referenced
	 * by another object which falls in this transaction.
	 * @var boolean
	 */
	protected $alreadyInSave = false;

	/**
	 * Flag to prevent endless validation loop, if this object is referenced
	 * by another object which falls in this transaction.
	 * @var boolean
	 */
	protected $alreadyInValidation = false;

	/**
	 * Get the [code] column value.
	 * 
	 * @return string
	 */
	public function getCode()
	{

		return $this->code;
	}

	/**
	 * Get the [name] column value.
	 * 
	 * @return string
	 */
	public function getName()
	{

		return $this->name;
	}

	/**
	 * Get the [i18n] column value.
	 * 
	 * @return boolean
	 */
	public function getI18n()
	{

		return $this->i18n;
	}

	/**
	 * Get the [image] column value.
	 * 
	 * @return boolean
	 */
	public function getImage()
	{

		return $this->image;
	}

	/**
	 * Get the [active] column value.
	 * 
	 * @return boolean
	 */
	public function getActive()
	{

		return $this->active;
	}

	/**
	 * Set the value of [code] column.
	 * 
	 * @param string $v new value
	 * @return void
	 */
	public function setCode($v)
	{

		if ($this->code !== $v) {
			$this->code = $v;
			$this->modifiedColumns[] = LanguagePeer::CODE;
		}

	} // setCode()

	/**
	 * Set the value of [name] column.
	 * 
	 * @param string $v new value
	 * @return void
	 */
	public function setName($v)
	{

		if ($this->name !== $v) {
			$this->name = $v;
			$this->modifiedColumns[] = LanguagePeer::NAME;
		}

	} // setName()

	/**
	 * Set the value of [i18n] column.
	 * 
	 * @param boolean $v new value
	 * @return void
	 */
	public function setI18n($v)
	{

		if ($this->i18n !== $v || $v === false) {
			$this->i18n = $v;
			$this->modifiedColumns[] = LanguagePeer::I18N;
		}

	} // setI18n()

	/**
	 * Set the value of [image] column.
	 * 
	 * @param boolean $v new value
	 * @return void
	 */
	public function setImage($v)
	{

		if ($this->image !== $v || $v === false) {
			$this->image = $v;
			$this->modifiedColumns[] = LanguagePeer::IMAGE;
		}

	} // setImage()

	/**
	 * Set the value of [active] column.
	 * 
	 * @param boolean $v new value
	 * @return void
	 */
	public function setActive($v)
	{

		if ($this->active !== $v || $v === false) {
			$this->active = $v;
			$this->modifiedColumns[] = LanguagePeer::ACTIVE;
		}

	} // setActive()

	/**
	 * Hydrates (populates) the object variables with values from the database resultset.
	 *
	 * An offset (1-based "start column") is specified so that objects can be hydrated
	 * with a subset of the columns in the resultset rows.  This is needed, for example,
	 * for results of JOIN queries where the resultset row includes columns from two or
	 * more tables.
	 *
	 * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
	 * @param int $startcol 1-based offset column which indicates which restultset column to start with.
	 * @return int next starting column
	 * @throws PropelException  - Any caught Exception will be rewrapped as a PropelException.
	 */
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->code = $rs->getString($startcol + 0);

			$this->name = $rs->getString($startcol + 1);

			$this->i18n = $rs->getBoolean($startcol + 2);

			$this->image = $rs->getBoolean($startcol + 3);

			$this->active = $rs->getBoolean($startcol + 4);

			$this->setNew(false);

			// FIXME - using NUM_COLUMNS may be clearer.
			return $startcol + 5; // 5 = LanguagePeer::NUM_COLUMNS - LanguagePeer::NUM_LAZY_LOAD_COLUMNS).

		} catch (Exception $e) {
			throw new PropelException("Error populating Language object", $e);
		}
	}

	/**
	 * Removes this object from datastore and sets delete attribute.
	 *
	 * @param Connection $con
	 * @return void
	 * @throws PropelException
	 * @see BaseObject::setDeleted()
	 * @see BaseObject::isDeleted()
	 */
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(LanguagePeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			LanguagePeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	/**
	 * Stores the object in the database.  If the object is new,
	 * it inserts it; otherwise an update is performed.  This method
	 * wraps the doSave() worker method in a transaction.
	 *
	 * @param Connection $con
	 * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
	 * @throws PropelException
	 * @see doSave()
	 */
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(LanguagePeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	/**
	 * Stores the object in the database.
	 *
	 * If the object is new, it inserts it; otherwise an update is performed.
	 * All related objects are also updated in this method.
	 *
	 * @param Connection $con
	 * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
	 * @throws PropelException
	 * @see save()
	 */
	protected function doSave($con)
	{
		$affectedRows = 0; // initialize var to track total num of affected rows
		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


			// If this object has been modified, then save it to the database.
			if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = LanguagePeer::doInsert($this, $con);
					$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
										 // should always be true here (even though technically
										 // BasePeer::doInsert() can insert multiple rows).

					$this->setNew(false);
				} else {
					$affectedRows += LanguagePeer::doUpdate($this, $con);
				}
				$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
			}

			if ($this->collContentI18ns !== null) {
				foreach($this->collContentI18ns as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collCategoryI18ns !== null) {
				foreach($this->collCategoryI18ns as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collEventI18ns !== null) {
				foreach($this->collEventI18ns as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collGuideI18ns !== null) {
				foreach($this->collGuideI18ns as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collMenus !== null) {
				foreach($this->collMenus as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collMenuItemI18ns !== null) {
				foreach($this->collMenuItemI18ns as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collProjectI18ns !== null) {
				foreach($this->collProjectI18ns as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collStaffs !== null) {
				foreach($this->collStaffs as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} // doSave()

	/**
	 * Array of ValidationFailed objects.
	 * @var array ValidationFailed[]
	 */
	protected $validationFailures = array();

	/**
	 * Gets any ValidationFailed objects that resulted from last call to validate().
	 *
	 *
	 * @return array ValidationFailed[]
	 * @see validate()
	 */
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	/**
	 * Validates the objects modified field values and all objects related to this table.
	 *
	 * If $columns is either a column name or an array of column names
	 * only those columns are validated.
	 *
	 * @param mixed $columns Column name or an array of column names.
	 * @return boolean Whether all columns pass validation.
	 * @see doValidate()
	 * @see getValidationFailures()
	 */
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	/**
	 * This function performs the validation work for complex object models.
	 *
	 * In addition to checking the current object, all related objects will
	 * also be validated.  If all pass then <code>true</code> is returned; otherwise
	 * an aggreagated array of ValidationFailed objects will be returned.
	 *
	 * @param array $columns Array of column names to validate.
	 * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
	 */
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = LanguagePeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collContentI18ns !== null) {
					foreach($this->collContentI18ns as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collCategoryI18ns !== null) {
					foreach($this->collCategoryI18ns as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collEventI18ns !== null) {
					foreach($this->collEventI18ns as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collGuideI18ns !== null) {
					foreach($this->collGuideI18ns as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collMenus !== null) {
					foreach($this->collMenus as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collMenuItemI18ns !== null) {
					foreach($this->collMenuItemI18ns as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collProjectI18ns !== null) {
					foreach($this->collProjectI18ns as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collStaffs !== null) {
					foreach($this->collStaffs as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	/**
	 * Retrieves a field from the object by name passed in as a string.
	 *
	 * @param string $name name
	 * @param string $type The type of fieldname the $name is of:
	 *                     one of the class type constants TYPE_PHPNAME,
	 *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
	 * @return mixed Value of field.
	 */
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = LanguagePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	/**
	 * Retrieves a field from the object by Position as specified in the xml schema.
	 * Zero-based.
	 *
	 * @param int $pos position in xml schema
	 * @return mixed Value of field at $pos
	 */
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getCode();
				break;
			case 1:
				return $this->getName();
				break;
			case 2:
				return $this->getI18n();
				break;
			case 3:
				return $this->getImage();
				break;
			case 4:
				return $this->getActive();
				break;
			default:
				return null;
				break;
		} // switch()
	}

	/**
	 * Exports the object as an array.
	 *
	 * You can specify the key type of the array by passing one of the class
	 * type constants.
	 *
	 * @param string $keyType One of the class type constants TYPE_PHPNAME,
	 *                        TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
	 * @return an associative array containing the field names (as keys) and field values
	 */
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = LanguagePeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getCode(),
			$keys[1] => $this->getName(),
			$keys[2] => $this->getI18n(),
			$keys[3] => $this->getImage(),
			$keys[4] => $this->getActive(),
		);
		return $result;
	}

	/**
	 * Sets a field from the object by name passed in as a string.
	 *
	 * @param string $name peer name
	 * @param mixed $value field value
	 * @param string $type The type of fieldname the $name is of:
	 *                     one of the class type constants TYPE_PHPNAME,
	 *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
	 * @return void
	 */
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = LanguagePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	/**
	 * Sets a field from the object by Position as specified in the xml schema.
	 * Zero-based.
	 *
	 * @param int $pos position in xml schema
	 * @param mixed $value field value
	 * @return void
	 */
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setCode($value);
				break;
			case 1:
				$this->setName($value);
				break;
			case 2:
				$this->setI18n($value);
				break;
			case 3:
				$this->setImage($value);
				break;
			case 4:
				$this->setActive($value);
				break;
		} // switch()
	}

	/**
	 * Populates the object using an array.
	 *
	 * This is particularly useful when populating an object from one of the
	 * request arrays (e.g. $_POST).  This method goes through the column
	 * names, checking to see whether a matching key exists in populated
	 * array. If so the setByName() method is called for that column.
	 *
	 * You can specify the key type of the array by additionally passing one
	 * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
	 * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
	 *
	 * @param array  $arr     An array to populate the object from.
	 * @param string $keyType The type of keys the array uses.
	 * @return void
	 */
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = LanguagePeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setCode($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setI18n($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setImage($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setActive($arr[$keys[4]]);
	}

	/**
	 * Build a Criteria object containing the values of all modified columns in this object.
	 *
	 * @return Criteria The Criteria object containing all modified values.
	 */
	public function buildCriteria()
	{
		$criteria = new Criteria(LanguagePeer::DATABASE_NAME);

		if ($this->isColumnModified(LanguagePeer::CODE)) $criteria->add(LanguagePeer::CODE, $this->code);
		if ($this->isColumnModified(LanguagePeer::NAME)) $criteria->add(LanguagePeer::NAME, $this->name);
		if ($this->isColumnModified(LanguagePeer::I18N)) $criteria->add(LanguagePeer::I18N, $this->i18n);
		if ($this->isColumnModified(LanguagePeer::IMAGE)) $criteria->add(LanguagePeer::IMAGE, $this->image);
		if ($this->isColumnModified(LanguagePeer::ACTIVE)) $criteria->add(LanguagePeer::ACTIVE, $this->active);

		return $criteria;
	}

	/**
	 * Builds a Criteria object containing the primary key for this object.
	 *
	 * Unlike buildCriteria() this method includes the primary key values regardless
	 * of whether or not they have been modified.
	 *
	 * @return Criteria The Criteria object containing value(s) for primary key(s).
	 */
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(LanguagePeer::DATABASE_NAME);

		$criteria->add(LanguagePeer::CODE, $this->code);

		return $criteria;
	}

	/**
	 * Returns the primary key for this object (row).
	 * @return string
	 */
	public function getPrimaryKey()
	{
		return $this->getCode();
	}

	/**
	 * Generic method to set the primary key (code column).
	 *
	 * @param string $key Primary key.
	 * @return void
	 */
	public function setPrimaryKey($key)
	{
		$this->setCode($key);
	}

	/**
	 * Sets contents of passed object to values from current object.
	 *
	 * If desired, this method can also make copies of all associated (fkey referrers)
	 * objects.
	 *
	 * @param object $copyObj An object of Language (or compatible) type.
	 * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
	 * @throws PropelException
	 */
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setName($this->name);

		$copyObj->setI18n($this->i18n);

		$copyObj->setImage($this->image);

		$copyObj->setActive($this->active);


		if ($deepCopy) {
			// important: temporarily setNew(false) because this affects the behavior of
			// the getter/setter methods for fkey referrer objects.
			$copyObj->setNew(false);

			foreach($this->getContentI18ns() as $relObj) {
				$copyObj->addContentI18n($relObj->copy($deepCopy));
			}

			foreach($this->getCategoryI18ns() as $relObj) {
				$copyObj->addCategoryI18n($relObj->copy($deepCopy));
			}

			foreach($this->getEventI18ns() as $relObj) {
				$copyObj->addEventI18n($relObj->copy($deepCopy));
			}

			foreach($this->getGuideI18ns() as $relObj) {
				$copyObj->addGuideI18n($relObj->copy($deepCopy));
			}

			foreach($this->getMenus() as $relObj) {
				$copyObj->addMenu($relObj->copy($deepCopy));
			}

			foreach($this->getMenuItemI18ns() as $relObj) {
				$copyObj->addMenuItemI18n($relObj->copy($deepCopy));
			}

			foreach($this->getProjectI18ns() as $relObj) {
				$copyObj->addProjectI18n($relObj->copy($deepCopy));
			}

			foreach($this->getStaffs() as $relObj) {
				$copyObj->addStaff($relObj->copy($deepCopy));
			}

		} // if ($deepCopy)


		$copyObj->setNew(true);

		$copyObj->setCode(NULL); // this is a pkey column, so set to default value

	}

	/**
	 * Makes a copy of this object that will be inserted as a new row in table when saved.
	 * It creates a new object filling in the simple attributes, but skipping any primary
	 * keys that are defined for the table.
	 *
	 * If desired, this method can also make copies of all associated (fkey referrers)
	 * objects.
	 *
	 * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
	 * @return Language Clone of current object.
	 * @throws PropelException
	 */
	public function copy($deepCopy = false)
	{
		// we use get_class(), because this might be a subclass
		$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	/**
	 * Returns a peer instance associated with this om.
	 *
	 * Since Peer classes are not to have any instance attributes, this method returns the
	 * same instance for all member of this class. The method could therefore
	 * be static, but this would prevent one from overriding the behavior.
	 *
	 * @return LanguagePeer
	 */
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new LanguagePeer();
		}
		return self::$peer;
	}

	/**
	 * Temporary storage of collContentI18ns to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initContentI18ns()
	{
		if ($this->collContentI18ns === null) {
			$this->collContentI18ns = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language has previously
	 * been saved, it will retrieve related ContentI18ns from storage.
	 * If this Language is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getContentI18ns($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/content/om/om/BaseContentI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collContentI18ns === null) {
			if ($this->isNew()) {
			   $this->collContentI18ns = array();
			} else {

				$criteria->add(ContentI18nPeer::LANGUAGE_CODE, $this->getCode());

				ContentI18nPeer::addSelectColumns($criteria);
				$this->collContentI18ns = ContentI18nPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(ContentI18nPeer::LANGUAGE_CODE, $this->getCode());

				ContentI18nPeer::addSelectColumns($criteria);
				if (!isset($this->lastContentI18nCriteria) || !$this->lastContentI18nCriteria->equals($criteria)) {
					$this->collContentI18ns = ContentI18nPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastContentI18nCriteria = $criteria;
		return $this->collContentI18ns;
	}

	/**
	 * Returns the number of related ContentI18ns.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countContentI18ns($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/content/om/om/BaseContentI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ContentI18nPeer::LANGUAGE_CODE, $this->getCode());

		return ContentI18nPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a ContentI18n object to this object
	 * through the ContentI18n foreign key attribute
	 *
	 * @param ContentI18n $l ContentI18n
	 * @return void
	 * @throws PropelException
	 */
	public function addContentI18n(ContentI18n $l)
	{
		$this->collContentI18ns[] = $l;
		$l->setLanguage($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language is new, it will return
	 * an empty collection; or if this Language has previously
	 * been saved, it will retrieve related ContentI18ns from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Language.
	 */
	public function getContentI18nsJoinContent($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/content/om/om/BaseContentI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collContentI18ns === null) {
			if ($this->isNew()) {
				$this->collContentI18ns = array();
			} else {

				$criteria->add(ContentI18nPeer::LANGUAGE_CODE, $this->getCode());

				$this->collContentI18ns = ContentI18nPeer::doSelectJoinContent($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(ContentI18nPeer::LANGUAGE_CODE, $this->getCode());

			if (!isset($this->lastContentI18nCriteria) || !$this->lastContentI18nCriteria->equals($criteria)) {
				$this->collContentI18ns = ContentI18nPeer::doSelectJoinContent($criteria, $con);
			}
		}
		$this->lastContentI18nCriteria = $criteria;

		return $this->collContentI18ns;
	}

	/**
	 * Temporary storage of collCategoryI18ns to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initCategoryI18ns()
	{
		if ($this->collCategoryI18ns === null) {
			$this->collCategoryI18ns = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language has previously
	 * been saved, it will retrieve related CategoryI18ns from storage.
	 * If this Language is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getCategoryI18ns($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/core/om/om/BaseCategoryI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collCategoryI18ns === null) {
			if ($this->isNew()) {
			   $this->collCategoryI18ns = array();
			} else {

				$criteria->add(CategoryI18nPeer::LANGUAGE_CODE, $this->getCode());

				CategoryI18nPeer::addSelectColumns($criteria);
				$this->collCategoryI18ns = CategoryI18nPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(CategoryI18nPeer::LANGUAGE_CODE, $this->getCode());

				CategoryI18nPeer::addSelectColumns($criteria);
				if (!isset($this->lastCategoryI18nCriteria) || !$this->lastCategoryI18nCriteria->equals($criteria)) {
					$this->collCategoryI18ns = CategoryI18nPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastCategoryI18nCriteria = $criteria;
		return $this->collCategoryI18ns;
	}

	/**
	 * Returns the number of related CategoryI18ns.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countCategoryI18ns($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/core/om/om/BaseCategoryI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(CategoryI18nPeer::LANGUAGE_CODE, $this->getCode());

		return CategoryI18nPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a CategoryI18n object to this object
	 * through the CategoryI18n foreign key attribute
	 *
	 * @param CategoryI18n $l CategoryI18n
	 * @return void
	 * @throws PropelException
	 */
	public function addCategoryI18n(CategoryI18n $l)
	{
		$this->collCategoryI18ns[] = $l;
		$l->setLanguage($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language is new, it will return
	 * an empty collection; or if this Language has previously
	 * been saved, it will retrieve related CategoryI18ns from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Language.
	 */
	public function getCategoryI18nsJoinCategory($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/core/om/om/BaseCategoryI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collCategoryI18ns === null) {
			if ($this->isNew()) {
				$this->collCategoryI18ns = array();
			} else {

				$criteria->add(CategoryI18nPeer::LANGUAGE_CODE, $this->getCode());

				$this->collCategoryI18ns = CategoryI18nPeer::doSelectJoinCategory($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(CategoryI18nPeer::LANGUAGE_CODE, $this->getCode());

			if (!isset($this->lastCategoryI18nCriteria) || !$this->lastCategoryI18nCriteria->equals($criteria)) {
				$this->collCategoryI18ns = CategoryI18nPeer::doSelectJoinCategory($criteria, $con);
			}
		}
		$this->lastCategoryI18nCriteria = $criteria;

		return $this->collCategoryI18ns;
	}

	/**
	 * Temporary storage of collEventI18ns to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initEventI18ns()
	{
		if ($this->collEventI18ns === null) {
			$this->collEventI18ns = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language has previously
	 * been saved, it will retrieve related EventI18ns from storage.
	 * If this Language is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getEventI18ns($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/event/om/om/BaseEventI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collEventI18ns === null) {
			if ($this->isNew()) {
			   $this->collEventI18ns = array();
			} else {

				$criteria->add(EventI18nPeer::LANGUAGE_CODE, $this->getCode());

				EventI18nPeer::addSelectColumns($criteria);
				$this->collEventI18ns = EventI18nPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(EventI18nPeer::LANGUAGE_CODE, $this->getCode());

				EventI18nPeer::addSelectColumns($criteria);
				if (!isset($this->lastEventI18nCriteria) || !$this->lastEventI18nCriteria->equals($criteria)) {
					$this->collEventI18ns = EventI18nPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastEventI18nCriteria = $criteria;
		return $this->collEventI18ns;
	}

	/**
	 * Returns the number of related EventI18ns.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countEventI18ns($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/event/om/om/BaseEventI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(EventI18nPeer::LANGUAGE_CODE, $this->getCode());

		return EventI18nPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a EventI18n object to this object
	 * through the EventI18n foreign key attribute
	 *
	 * @param EventI18n $l EventI18n
	 * @return void
	 * @throws PropelException
	 */
	public function addEventI18n(EventI18n $l)
	{
		$this->collEventI18ns[] = $l;
		$l->setLanguage($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language is new, it will return
	 * an empty collection; or if this Language has previously
	 * been saved, it will retrieve related EventI18ns from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Language.
	 */
	public function getEventI18nsJoinEvent($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/event/om/om/BaseEventI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collEventI18ns === null) {
			if ($this->isNew()) {
				$this->collEventI18ns = array();
			} else {

				$criteria->add(EventI18nPeer::LANGUAGE_CODE, $this->getCode());

				$this->collEventI18ns = EventI18nPeer::doSelectJoinEvent($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(EventI18nPeer::LANGUAGE_CODE, $this->getCode());

			if (!isset($this->lastEventI18nCriteria) || !$this->lastEventI18nCriteria->equals($criteria)) {
				$this->collEventI18ns = EventI18nPeer::doSelectJoinEvent($criteria, $con);
			}
		}
		$this->lastEventI18nCriteria = $criteria;

		return $this->collEventI18ns;
	}

	/**
	 * Temporary storage of collGuideI18ns to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initGuideI18ns()
	{
		if ($this->collGuideI18ns === null) {
			$this->collGuideI18ns = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language has previously
	 * been saved, it will retrieve related GuideI18ns from storage.
	 * If this Language is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getGuideI18ns($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/guide/om/om/BaseGuideI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collGuideI18ns === null) {
			if ($this->isNew()) {
			   $this->collGuideI18ns = array();
			} else {

				$criteria->add(GuideI18nPeer::LANGUAGE_CODE, $this->getCode());

				GuideI18nPeer::addSelectColumns($criteria);
				$this->collGuideI18ns = GuideI18nPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(GuideI18nPeer::LANGUAGE_CODE, $this->getCode());

				GuideI18nPeer::addSelectColumns($criteria);
				if (!isset($this->lastGuideI18nCriteria) || !$this->lastGuideI18nCriteria->equals($criteria)) {
					$this->collGuideI18ns = GuideI18nPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastGuideI18nCriteria = $criteria;
		return $this->collGuideI18ns;
	}

	/**
	 * Returns the number of related GuideI18ns.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countGuideI18ns($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/guide/om/om/BaseGuideI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(GuideI18nPeer::LANGUAGE_CODE, $this->getCode());

		return GuideI18nPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a GuideI18n object to this object
	 * through the GuideI18n foreign key attribute
	 *
	 * @param GuideI18n $l GuideI18n
	 * @return void
	 * @throws PropelException
	 */
	public function addGuideI18n(GuideI18n $l)
	{
		$this->collGuideI18ns[] = $l;
		$l->setLanguage($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language is new, it will return
	 * an empty collection; or if this Language has previously
	 * been saved, it will retrieve related GuideI18ns from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Language.
	 */
	public function getGuideI18nsJoinGuide($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/guide/om/om/BaseGuideI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collGuideI18ns === null) {
			if ($this->isNew()) {
				$this->collGuideI18ns = array();
			} else {

				$criteria->add(GuideI18nPeer::LANGUAGE_CODE, $this->getCode());

				$this->collGuideI18ns = GuideI18nPeer::doSelectJoinGuide($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(GuideI18nPeer::LANGUAGE_CODE, $this->getCode());

			if (!isset($this->lastGuideI18nCriteria) || !$this->lastGuideI18nCriteria->equals($criteria)) {
				$this->collGuideI18ns = GuideI18nPeer::doSelectJoinGuide($criteria, $con);
			}
		}
		$this->lastGuideI18nCriteria = $criteria;

		return $this->collGuideI18ns;
	}

	/**
	 * Temporary storage of collMenus to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initMenus()
	{
		if ($this->collMenus === null) {
			$this->collMenus = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language has previously
	 * been saved, it will retrieve related Menus from storage.
	 * If this Language is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getMenus($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collMenus === null) {
			if ($this->isNew()) {
			   $this->collMenus = array();
			} else {

				$criteria->add(MenuPeer::LANGUAGE_CODE, $this->getCode());

				MenuPeer::addSelectColumns($criteria);
				$this->collMenus = MenuPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(MenuPeer::LANGUAGE_CODE, $this->getCode());

				MenuPeer::addSelectColumns($criteria);
				if (!isset($this->lastMenuCriteria) || !$this->lastMenuCriteria->equals($criteria)) {
					$this->collMenus = MenuPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastMenuCriteria = $criteria;
		return $this->collMenus;
	}

	/**
	 * Returns the number of related Menus.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countMenus($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(MenuPeer::LANGUAGE_CODE, $this->getCode());

		return MenuPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Menu object to this object
	 * through the Menu foreign key attribute
	 *
	 * @param Menu $l Menu
	 * @return void
	 * @throws PropelException
	 */
	public function addMenu(Menu $l)
	{
		$this->collMenus[] = $l;
		$l->setLanguage($this);
	}

	/**
	 * Temporary storage of collMenuItemI18ns to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initMenuItemI18ns()
	{
		if ($this->collMenuItemI18ns === null) {
			$this->collMenuItemI18ns = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language has previously
	 * been saved, it will retrieve related MenuItemI18ns from storage.
	 * If this Language is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getMenuItemI18ns($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuItemI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collMenuItemI18ns === null) {
			if ($this->isNew()) {
			   $this->collMenuItemI18ns = array();
			} else {

				$criteria->add(MenuItemI18nPeer::LANGUAGE_CODE, $this->getCode());

				MenuItemI18nPeer::addSelectColumns($criteria);
				$this->collMenuItemI18ns = MenuItemI18nPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(MenuItemI18nPeer::LANGUAGE_CODE, $this->getCode());

				MenuItemI18nPeer::addSelectColumns($criteria);
				if (!isset($this->lastMenuItemI18nCriteria) || !$this->lastMenuItemI18nCriteria->equals($criteria)) {
					$this->collMenuItemI18ns = MenuItemI18nPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastMenuItemI18nCriteria = $criteria;
		return $this->collMenuItemI18ns;
	}

	/**
	 * Returns the number of related MenuItemI18ns.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countMenuItemI18ns($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuItemI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(MenuItemI18nPeer::LANGUAGE_CODE, $this->getCode());

		return MenuItemI18nPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a MenuItemI18n object to this object
	 * through the MenuItemI18n foreign key attribute
	 *
	 * @param MenuItemI18n $l MenuItemI18n
	 * @return void
	 * @throws PropelException
	 */
	public function addMenuItemI18n(MenuItemI18n $l)
	{
		$this->collMenuItemI18ns[] = $l;
		$l->setLanguage($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language is new, it will return
	 * an empty collection; or if this Language has previously
	 * been saved, it will retrieve related MenuItemI18ns from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Language.
	 */
	public function getMenuItemI18nsJoinMenuItem($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuItemI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collMenuItemI18ns === null) {
			if ($this->isNew()) {
				$this->collMenuItemI18ns = array();
			} else {

				$criteria->add(MenuItemI18nPeer::LANGUAGE_CODE, $this->getCode());

				$this->collMenuItemI18ns = MenuItemI18nPeer::doSelectJoinMenuItem($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(MenuItemI18nPeer::LANGUAGE_CODE, $this->getCode());

			if (!isset($this->lastMenuItemI18nCriteria) || !$this->lastMenuItemI18nCriteria->equals($criteria)) {
				$this->collMenuItemI18ns = MenuItemI18nPeer::doSelectJoinMenuItem($criteria, $con);
			}
		}
		$this->lastMenuItemI18nCriteria = $criteria;

		return $this->collMenuItemI18ns;
	}

	/**
	 * Temporary storage of collProjectI18ns to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initProjectI18ns()
	{
		if ($this->collProjectI18ns === null) {
			$this->collProjectI18ns = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language has previously
	 * been saved, it will retrieve related ProjectI18ns from storage.
	 * If this Language is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getProjectI18ns($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/project/om/om/BaseProjectI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collProjectI18ns === null) {
			if ($this->isNew()) {
			   $this->collProjectI18ns = array();
			} else {

				$criteria->add(ProjectI18nPeer::LANGUAGE_CODE, $this->getCode());

				ProjectI18nPeer::addSelectColumns($criteria);
				$this->collProjectI18ns = ProjectI18nPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(ProjectI18nPeer::LANGUAGE_CODE, $this->getCode());

				ProjectI18nPeer::addSelectColumns($criteria);
				if (!isset($this->lastProjectI18nCriteria) || !$this->lastProjectI18nCriteria->equals($criteria)) {
					$this->collProjectI18ns = ProjectI18nPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastProjectI18nCriteria = $criteria;
		return $this->collProjectI18ns;
	}

	/**
	 * Returns the number of related ProjectI18ns.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countProjectI18ns($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/project/om/om/BaseProjectI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ProjectI18nPeer::LANGUAGE_CODE, $this->getCode());

		return ProjectI18nPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a ProjectI18n object to this object
	 * through the ProjectI18n foreign key attribute
	 *
	 * @param ProjectI18n $l ProjectI18n
	 * @return void
	 * @throws PropelException
	 */
	public function addProjectI18n(ProjectI18n $l)
	{
		$this->collProjectI18ns[] = $l;
		$l->setLanguage($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language is new, it will return
	 * an empty collection; or if this Language has previously
	 * been saved, it will retrieve related ProjectI18ns from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Language.
	 */
	public function getProjectI18nsJoinProject($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/project/om/om/BaseProjectI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collProjectI18ns === null) {
			if ($this->isNew()) {
				$this->collProjectI18ns = array();
			} else {

				$criteria->add(ProjectI18nPeer::LANGUAGE_CODE, $this->getCode());

				$this->collProjectI18ns = ProjectI18nPeer::doSelectJoinProject($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(ProjectI18nPeer::LANGUAGE_CODE, $this->getCode());

			if (!isset($this->lastProjectI18nCriteria) || !$this->lastProjectI18nCriteria->equals($criteria)) {
				$this->collProjectI18ns = ProjectI18nPeer::doSelectJoinProject($criteria, $con);
			}
		}
		$this->lastProjectI18nCriteria = $criteria;

		return $this->collProjectI18ns;
	}

	/**
	 * Temporary storage of collStaffs to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initStaffs()
	{
		if ($this->collStaffs === null) {
			$this->collStaffs = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language has previously
	 * been saved, it will retrieve related Staffs from storage.
	 * If this Language is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getStaffs($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/staff/om/om/BaseStaffPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collStaffs === null) {
			if ($this->isNew()) {
			   $this->collStaffs = array();
			} else {

				$criteria->add(StaffPeer::LANGUAGE_CODE, $this->getCode());

				StaffPeer::addSelectColumns($criteria);
				$this->collStaffs = StaffPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(StaffPeer::LANGUAGE_CODE, $this->getCode());

				StaffPeer::addSelectColumns($criteria);
				if (!isset($this->lastStaffCriteria) || !$this->lastStaffCriteria->equals($criteria)) {
					$this->collStaffs = StaffPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastStaffCriteria = $criteria;
		return $this->collStaffs;
	}

	/**
	 * Returns the number of related Staffs.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countStaffs($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/staff/om/om/BaseStaffPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(StaffPeer::LANGUAGE_CODE, $this->getCode());

		return StaffPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Staff object to this object
	 * through the Staff foreign key attribute
	 *
	 * @param Staff $l Staff
	 * @return void
	 * @throws PropelException
	 */
	public function addStaff(Staff $l)
	{
		$this->collStaffs[] = $l;
		$l->setLanguage($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language is new, it will return
	 * an empty collection; or if this Language has previously
	 * been saved, it will retrieve related Staffs from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Language.
	 */
	public function getStaffsJoinImageRelatedByThumbnailId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/staff/om/om/BaseStaffPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collStaffs === null) {
			if ($this->isNew()) {
				$this->collStaffs = array();
			} else {

				$criteria->add(StaffPeer::LANGUAGE_CODE, $this->getCode());

				$this->collStaffs = StaffPeer::doSelectJoinImageRelatedByThumbnailId($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(StaffPeer::LANGUAGE_CODE, $this->getCode());

			if (!isset($this->lastStaffCriteria) || !$this->lastStaffCriteria->equals($criteria)) {
				$this->collStaffs = StaffPeer::doSelectJoinImageRelatedByThumbnailId($criteria, $con);
			}
		}
		$this->lastStaffCriteria = $criteria;

		return $this->collStaffs;
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Language is new, it will return
	 * an empty collection; or if this Language has previously
	 * been saved, it will retrieve related Staffs from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Language.
	 */
	public function getStaffsJoinImageRelatedByImageId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/staff/om/om/BaseStaffPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collStaffs === null) {
			if ($this->isNew()) {
				$this->collStaffs = array();
			} else {

				$criteria->add(StaffPeer::LANGUAGE_CODE, $this->getCode());

				$this->collStaffs = StaffPeer::doSelectJoinImageRelatedByImageId($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(StaffPeer::LANGUAGE_CODE, $this->getCode());

			if (!isset($this->lastStaffCriteria) || !$this->lastStaffCriteria->equals($criteria)) {
				$this->collStaffs = StaffPeer::doSelectJoinImageRelatedByImageId($criteria, $con);
			}
		}
		$this->lastStaffCriteria = $criteria;

		return $this->collStaffs;
	}

} // BaseLanguage
